//
//  SingleViewController.m
//  ManStoreDemo
//
//  Created by qianfeng01 on 15/7/20.
//  Copyright (c) 2015年 xiangmu. All rights reserved.
//

#import "SingleViewController.h"
#import "KxMenu.h"
#import "JacketViewController.h"
#import "PantsViewController.h"
#import "ShoesViewController.h"
#import "AccessoryViewController.h"
#import "WMPageController.h"
#import "BaseViewController.h"


@interface SingleViewController ()

@end

@implementation SingleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self createButton];
}
-(void)createButton{
    UIBarButtonItem *item=[[UIBarButtonItem alloc] initWithTitle:@"分类" style:UIBarButtonItemStylePlain target:self action:@selector(btn:)];
    
    self.navigationItem.leftBarButtonItem=item;
}
-(void)btn:(UIButton *)button{
    NSArray *menuItems =
    @[
      
      [KxMenuItem menuItem:@"上衣"
                     image:nil
                    target:self
                    action:@selector(pushMenuItem1:)],
      
      [KxMenuItem menuItem:@"裤子"
                     image:nil
                    target:self
                    action:@selector(pushMenuItem2:)],
      
      [KxMenuItem menuItem:@"鞋子"
                     image:nil
                    target:self
                    action:@selector(pushMenuItem3:)],
      
      [KxMenuItem menuItem:@"配饰"
                     image:nil
                    target:self
                    action:@selector(pushMenuItem4:)],
      
      ];
    
      [KxMenu showMenuInView:self.view
                  fromRect:CGRectMake(0,-400, 60, 400)
                 menuItems:menuItems];
}
-(void)pushMenuItem1:(id)sender{
    JacketViewController *VC=[[JacketViewController alloc] init];
    [self.navigationController pushViewController:VC animated:YES];
}

-(void)pushMenuItem2:(id)sender{
    
    PantsViewController *VC=[[PantsViewController alloc] init];
    [self.navigationController pushViewController:VC animated:YES];
}

-(void)pushMenuItem3:(id)sender{
    ShoesViewController *VC=[[ShoesViewController alloc] init];
    [self.navigationController pushViewController:VC animated:YES];
}

-(void)pushMenuItem4:(id)sender{
    AccessoryViewController *VC=[[AccessoryViewController alloc] init];
    [self.navigationController pushViewController:VC animated:YES];
}

-(void)createRollViewArr:(NSArray *)arr RollArr:(NSMutableArray *)rollArr{
    NSMutableArray *rlArr=[[NSMutableArray alloc] init];
    NSMutableArray *allArr=[[NSMutableArray alloc] init];
    for (int i=0; i<rollArr.count; i++) {
        Class cls=NSClassFromString(rollArr[i]);
        UIViewController *VC=[[cls alloc] init];
        ((BaseViewController*)VC).containerViewContrller = self;
        
        [rlArr addObject:VC];
    }
    WMPageController *pc=[[WMPageController alloc] initWithViewControllers:rlArr andTheirTitles:arr];
    pc.menuItemWidth=87;
    UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:pc];
   // nav.navigationBarHidden=YES;
   // self.hidesBottomBarWhenPushed=YES;
   
    [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"gray_kuang"] forBarMetrics:UIBarMetricsDefault];

    [allArr addObject:nav];
    self.tabBarController.viewControllers=allArr;

}

@end
